﻿#ifndef CHATDIALOG_HPP
#define CHATDIALOG_HPP

#include "skin_change_event.hpp"
#include "UIFriends.hpp"

class ChatDialog : public CWndImplBase, public SkinChangedReceiver
{
public:
    ChatDialog(const CDuiString &bgimage, DWORD bkcolor, const FriendListItemInfo &myselft_info,
               const FriendListItemInfo &friend_info);
    ~ChatDialog();

public:
    LPCTSTR GetWindowClassName() const;
    virtual void OnFinalMessage(HWND hWnd);
    virtual void InitWindow();
    virtual LRESULT ResponseDefaultKeyEvent(WPARAM wParam);
    virtual CDuiString GetSkinFile();
    virtual CDuiString GetSkinFolder();
    virtual CControlUI *CreateControl(LPCTSTR pstrClass);
    virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
    virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
    virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
    virtual LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
    virtual BOOL Receive(SkinChangedParam param);
    virtual LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);

    void SetTextColor(DWORD dwColor);
    void SendMsg();

protected:

    void Notify(TNotifyUI &msg);
    void OnPrepare(TNotifyUI &msg);
    void OnExit(TNotifyUI &msg);
    void OnTimer(TNotifyUI &msg);

private:
    void FontStyleChanged();

private:
    bool emotion_timer_start_;

    bool bold_;
    bool italic_;
    bool underline_;
    DWORD text_color_;
    DWORD font_size_;
    CDuiString font_face_name_;

    CDuiString bgimage_;
    DWORD bkcolor_;
    FriendListItemInfo myselft_;
    FriendListItemInfo friend_;
};

#endif // CHARTDIALOG_HPP